﻿<%@ Page Language="C#" MasterPageFile="~/default.master" AutoEventWireup="true" CodeFile="ProductDetail.aspx.cs"
    Inherits="ProductDetail" %>

<%@ Import Namespace="ShopModel" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>
<%@ Register Src="controls/ctrlShowAvailableCount.ascx" TagName="ctrlShowAvailableCount"
    TagPrefix="uc1" %>
<%@ Register Src="controls/ctrlPriceChangeGraph.ascx" TagName="ctrlPriceChangeGraph"
    TagPrefix="uc2" %>
<%@ Register Src="controls/ctrlProductsToCompare.ascx" TagName="ctrlProductsToCompare"
    TagPrefix="uc2" %>
<%@ Register Src="controls/ctrlProductCompareManager.ascx" TagName="ctrlProductCompareManager"
    TagPrefix="uc2" %>
<%@ Register Src="controls/ctrlCrossSell.ascx" TagName="ctrlCrossSell" TagPrefix="uc1" %>
<asp:Content ID="Content1" ContentPlaceHolderID="cphMain" runat="Server">

    <script type="text/javascript" src="Javascript/lightbox.js"></script>

    <script type="text/javascript" src="Javascript/ProductDetail.js"></script>

    <div id="product-detail">
        <div id="product-name">
            <h2>
                <%= _Product.Name %>
            </h2>
        </div>
        <div class="detail">
            <div style="width: 100%">
                <span style="float: left;"><a href="<%=ViewState["BackUrl"] %>">
                    <%=Resources.Language.Back %></a> </span><span style="float: right;"><a href="#"
                        onclick="window.open('<%= _ProductID.ToString() +"," + Resources.Language.UrlPrintProduct.ToLower()+".aspx"%>', '','toolbar=yes,location=no,directories=no,status=no,menubar=yes,scrollbars=yes,resizable=no,copyhistory=no');">
                        <%=Resources.Language.PrintDescription %></a>&nbsp;|&nbsp; <a href="#" id="aRecommendProduct"
                            onclick=" $('.RecommendProduct')[0].style.display = 'inline'" runat="server">
                            <%=Resources.Language.RecommendToFriend%></a>&nbsp;|&nbsp; <a href="#" onclick="$('.priceChangesGraph')[0].style.display = 'inline'; return false;">
                                <%=Resources.Language.PriceChanges %></a>&nbsp;|&nbsp;
                        <uc2:ctrlProductCompareManager ID="pcmSelectedProducts" runat="server" OnSelectedProductsChanged="pcmSelectedProducts_Changed" />
                    </span>
            </div>
            <br />
            <div style="width: 100%">
                <table style="background: none;">
                    <tr>
                        <td>
                            <asp:DataList ID="dlPictures" RepeatColumns="6" RepeatDirection="Horizontal" RepeatLayout="Table"
                                runat="server" CellSpacing="2">
                                <ItemTemplate>
                                    <a href='<%#Eval("VirtualPath").ToString().Remove(0,2) %>' rel="lightbox">
                                        <img src='<%#((PictureInfo)(Container.DataItem)).Miniature.VirtualPath.Remove(0,2) %>'
                                            alt="" style="border-width: 0px;" /></a>
                                </ItemTemplate>
                            </asp:DataList>
                        </td>
                        <td class="details-price">
                            <div id="product-price">
                                <span>
                                    <%=Resources.Language.Price %>: <strong>
                                        <%= _Product.SpecialOfferPriceBrutto != null ? _Product.SpecialOfferPriceBrutto.ToString() + " " + Resources.Language.Currency + " (" + _Product.SpecialOfferPriceNetto.ToString() + " " + Resources.Language.CurrencyWithoutVAT + ")" : _Product.PriceBrutto.ToString() + " " + Resources.Language.Currency + " (" + _Product.PriceNetto.ToString() + " " + Resources.Language.CurrencyWithoutVAT + ")"%>
                                    </strong></span>
                                <%= _Product.SpecialOfferPriceBrutto != null ? " <span style=\"text-decoration: line-through; color: Red;\">" + _Product.PriceBrutto.ToString() + " " + Resources.Language.Currency + " (" + _Product.PriceNetto.ToString() + " " + Resources.Language.CurrencyWithoutVAT + ")</span>" : ""%>
                                <uc1:ctrlShowAvailableCount ID="ctrlShowAvailableCount" runat="server" />
                                <br />
                                <%=Resources.Language.AverageRate %>: <span style="font-weight: bold;">
                                    <asp:Literal ID="lAvgRate" runat="server"></asp:Literal></span>
                                <div class="product-detail-addToBasket">
                                    <a id="aAddToBasket" runat="server" href="#">
                                        <%=Resources.Language.AddToBasket %>
                                    </a>
                                </div>
                            </div>
                        </td>
                    </tr>
                </table>
            </div>
            <% if (_Product.Description != string.Empty)
               { %>
            <h1>
                <%=Resources.Language.Description%>:</h1>
            <div id="product-description" class="description">
                <%= _Product.Description%>
            </div>
            <% }%>
            <% if (_Product.PropertyList.Count > 0)
               { %>
            <h1>
                <%=Resources.Language.Details %>:</h1>
            <div>
                <table>
                    <tbody>
                        <tr>
                            <td class="left">
                                <%=Resources.Language.Producer %>:
                            </td>
                            <td class="right">
                                <%=_Product.Producer.Name %>
                            </td>
                        </tr>
                        <asp:Repeater ID="rptProperty" runat="server">
                            <ItemTemplate>
                                <tr>
                                    <td class="left">
                                        <%#Eval("Name") %>:
                                    </td>
                                    <td class="right">
                                        <%#Eval("Value") %>
                                    </td>
                                </tr>
                            </ItemTemplate>
                        </asp:Repeater>
                    </tbody>
                </table>
            </div>
            <%} %>
            <div>
                <% if (rptDocuments.Items.Count > 0)
                   { %>
                <asp:Repeater ID="rptDocuments" runat="server">
                    <HeaderTemplate>
                        <h1>
                            <%= Resources.Language.Attachments %>:
                        </h1>
                    </HeaderTemplate>
                    <ItemTemplate>
                        <div>
                            <a href='<%# Eval("Url") %>' target="_blank">
                                <%# Eval("FileName") %></a>
                        </div>
                    </ItemTemplate>
                </asp:Repeater>
                <%} %>
                <% if (rptVideos.Items.Count > 0)
                   { %>
                <asp:Repeater ID="rptVideos" runat="server">
                    <HeaderTemplate>
                        <h1>
                            <%= Resources.Language.Video %>:
                        </h1>
                    </HeaderTemplate>
                    <ItemTemplate>
                        <div>
                            <a href="#" onclick="window.open('<%# Eval("VideoID").ToString()+","+Resources.Language.UrlWatchVideo.ToLower()+".aspx"%>', '','width=495,height=335,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,copyhistory=no');">
                                <%# Eval("Label") %></a>
                        </div>
                    </ItemTemplate>
                </asp:Repeater>
                <%} %>
            </div>
            <%if (Settings.ShowCrossSell)
              { %>
            <uc1:ctrlCrossSell ID="ctrlCrossSell1" runat="server" />
            <%} %>
            <asp:UpdatePanel ID="upComments" runat="server" UpdateMode="Conditional">
                <ContentTemplate>
                    <div id="comments" style="width: 100%;">
                        <div>
                            <%= Resources.Language.Author %>:<br />
                            <asp:TextBox ID="txtAuthor" runat="server"></asp:TextBox>
                            <asp:RequiredFieldValidator ID="valRequireAuthor" runat="server" ErrorMessage="RequiredFieldValidator"
                                ControlToValidate="txtAuthor" ValidationGroup="Comment" Display="Dynamic"></asp:RequiredFieldValidator><br />
                            <%=Resources.Language.Rate %>:<br />
                            <asp:DropDownList ID="ddlRate" runat="server" AutoPostBack="false">
                                <asp:ListItem Text="<%$Resources:Language,ProductRateCommand %>" Value="-1" Selected="True"></asp:ListItem>
                                <asp:ListItem Text="<%$Resources:Language,ProductRate6 %>" Value="6"></asp:ListItem>
                                <asp:ListItem Text="<%$Resources:Language,ProductRate5 %>" Value="5"></asp:ListItem>
                                <asp:ListItem Text="<%$Resources:Language,ProductRate4 %>" Value="4"></asp:ListItem>
                                <asp:ListItem Text="<%$Resources:Language,ProductRate3 %>" Value="3"></asp:ListItem>
                                <asp:ListItem Text="<%$Resources:Language,ProductRate2 %>" Value="2"></asp:ListItem>
                                <asp:ListItem Text="<%$Resources:Language,ProductRate1 %>" Value="1"></asp:ListItem>
                            </asp:DropDownList>
                            <asp:RequiredFieldValidator ID="valRequireRate" runat="server" ErrorMessage="RequiredFieldValidator"
                                Display="Dynamic" ControlToValidate="ddlRate" ValidationGroup="Comment" InitialValue="-1"></asp:RequiredFieldValidator>
                            <br />
                            <%= Resources.Language.Content %>:<br />
                            <asp:RequiredFieldValidator ID="valRequireContent" runat="server" ErrorMessage="RequiredFieldValidator"
                                Display="Dynamic" ControlToValidate="txtContent" ValidationGroup="Comment"></asp:RequiredFieldValidator>
                            <asp:TextBox ID="txtContent" runat="server" TextMode="MultiLine" Height="120px" Width="350px"></asp:TextBox>
                            <br />
                            <asp:Label ID="lblErrorComment" runat="server" EnableViewState="false" Visible="false"
                                Font-Bold="true"></asp:Label>
                            <asp:Button ID="btnAddComment" runat="server" Text="<%$ Resources:Language, AddComment %>"
                                OnClick="btnAddComment_Click" ValidationGroup="Comment" />
                        </div>
                        <div style="width: 100%; text-align: center">
                            <% if (gvComment.Rows.Count > 0)
                               { %>
                            <h1>
                                <%= Resources.Language.Comments%>:</h1>
                            <asp:GridView ID="gvComment" runat="server" CssClass="commentsTable" AllowPaging="True"
                                AutoGenerateColumns="False" EnableViewState="False" OnPageIndexChanging="gvComment_PageIndexChanging"
                                ShowHeader="false" GridLines="None">
                                <Columns>
                                    <asp:TemplateField>
                                        <ItemTemplate>
                                            <div class="author">
                                                <span class="author">
                                                    <%# Eval("Author") %></span> <span class="date">
                                                        <%# ((Comment)Container.DataItem).Date.ToLocalTime() %></span> <span>
                                                            <%= Resources.Language.Rate%>:
                                                            <%# ((Comment)Container.DataItem).Rate == ((decimal)-1) ? Resources.Language.LackLower : ((int)((Comment)Container.DataItem).Rate).ToString() %></span>
                                                <span>
                                                    <%# ((Comment)Container.DataItem).Accepted ? "" : "("+Resources.Language.CommentNotApprovedYed+")" %></span>
                                            </div>
                                            <div class="content">
                                                <%# ((Comment)Container.DataItem).Content.Replace("\r\n", "<br />") %>
                                            </div>
                                        </ItemTemplate>
                                    </asp:TemplateField>
                                </Columns>
                            </asp:GridView>
                            <% } %>
                        </div>
                    </div>
                </ContentTemplate>
                <Triggers>
                    <asp:AsyncPostBackTrigger ControlID="btnAddComment" />
                </Triggers>
            </asp:UpdatePanel>
            <asp:Panel ID="pRecommendProduct" runat="server" class="RecommendProduct">
                <asp:UpdatePanel ID="UpdatePanel3" runat="server" UpdateMode="Conditional">
                    <ContentTemplate>
                        <div class="clear">
                        </div>
                        <asp:Panel ID="pnlReccomentInside1" runat="server">
                            <table>
                                <tbody>
                                    <tr>
                                        <td align="right">
                                            <%=Resources.Language.Referrer %>:
                                        </td>
                                        <td>
                                            <asp:TextBox ID="tbRefferer" runat="server" Width="300px"></asp:TextBox><span id="vldmsgName"
                                                class="ValidatorInfo">*</span>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td align="right">
                                            <%=Resources.Language.FriendsEmail %>:
                                        </td>
                                        <td>
                                            <asp:TextBox ID="tbFriendEmail" runat="server" Width="300px"></asp:TextBox><span
                                                id="vldmsgEmail" class="ValidatorInfo">*</span>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td align="right">
                                            <%=Resources.Language.Content %>:
                                        </td>
                                        <td>
                                            <asp:TextBox ID="tbContent" runat="server" TextMode="MultiLine" Wrap="true" Width="300px"
                                                Height="100px" Rows="5"></asp:TextBox><span id="vldmsgContent" class="ValidatorInfo">*</span>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td colspan="2" align="center">
                                            <asp:Button ID="btnSendReccomendation" runat="server" Text="<%$Resources:Language,Send %>"
                                                OnClick="btnSendReccomendation_Click" OnClientClick="return SendEmail(this);" />
                                            <asp:Button ID="btnCancelReccomendation" runat="server" Text="<%$Resources:Language,Cancel %>"
                                                OnClientClick="$('.RecommendProduct')[0].style.display='none'; return false;" />
                                        </td>
                                    </tr>
                                </tbody>
                            </table>
                        </asp:Panel>
                        <asp:Panel ID="pnlReccomentInside2" runat="server" CssClass="RecommendProductInfo">
                            <%= Resources.Language.SendReccoment %><br />
                            <asp:Button ID="btnOKReccoment" runat="server" Text="OK" />
                        </asp:Panel>
                        <div id="please-wait" style="display: none">
                            <div class="RecommendProductWait">
                                <img src="gfx/ajaxLoader.gif" alt="Please Wait" />
                            </div>
                            <div class="RecommendProductWait-background">
                            </div>
                        </div>
                    </ContentTemplate>
                    <Triggers>
                        <asp:AsyncPostBackTrigger ControlID="btnSendReccomendation" />
                    </Triggers>
                </asp:UpdatePanel>
            </asp:Panel>
            <asp:Panel ID="pPriceChangesGraph" runat="server" class="priceChangesGraph">
                <uc2:ctrlPriceChangeGraph ID="ctrlPriceChangeGraph1" runat="server" LinesColor="#000"
                    BackgroundColor="#e3effb" GraphTextColor="#000" ProductNameColor="#000" GraphLineColor="#283b3b"
                    BorderColor="#e3effb" ProductID='<%=_ProductID%>' />
                <br />
                <input type="button" value='<%=Resources.Language.Close %>' onclick="$('.priceChangesGraph')[0].style.display = 'none'; return false;" />
            </asp:Panel>
        </div>
    </div>
</asp:Content>
